/*** Full testing dataset ***/
clear all
cd "I:\workdata\706727\Build\Data"
use MLSevfull

** Basic characteristics **
merge 1:1 pnr year using "I:\workdata\706727\Build\Data\ColSev_basechar"
keep if _merge==3
drop _merge 

** Psychiatric contacts **
merge 1:1 pnr year using "I:\workdata\706727\Build\Data\ColSev_lagvars"
keep if _merge==3
drop _merge 

** Medical and other sas data **
merge 1:1 pnr year using  "J:\Workdata\706727\Temp\MLData_Sev_Full.dta"
keep if _merge==3
drop _merge

tab civst, gen(Dumcivst)
drop civst

tab familie_type, gen(Dumfamtype)
drop familie_type

** Save **
compress

save MLSevdata_Full, replace


/*** Treated ***/
clear all
cd "I:\workdata\706727\Build\Data"
use MLSevSasTC

** Basic characteristics **
merge 1:1 pnr year using "I:\workdata\706727\Build\Data\ColSev_basechar"
keep if _merge==3
drop _merge 

** Psychiatric contacts **
merge 1:1 pnr year using "I:\workdata\706727\Build\Data\ColSev_lagvars"
keep if _merge==3
drop _merge 

** Medical and other sas data **
merge 1:1 pnr year using  "J:\Workdata\706727\Temp\MLData_Sev_Full.dta"
keep if _merge==3
drop _merge

tab civst, gen(Dumcivst)
drop civst

tab familie_type, gen(Dumfamtype)
drop familie_type

** Save **
compress

destring(famany),replace
save MLSevdata_Treat, replace

